package com.yunyao.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yunyao.dao.model.BamuPurchaseApplyMaterial;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
 * <p>
 * 合同材料表 Mapper 接口
 * </p>
 *
 * @author xingjishuai
 * @since 2024-07-02
 */
public interface BamuPurchaseApplyMaterialMapper extends BaseMapper<BamuPurchaseApplyMaterial> {
    BamuPurchaseApplyMaterial selectTotalByOrderId(String orderId);
    @Select("select sum(including_tax_total_price) from bamu_purchase_apply_material where "
            + "purchase_apply_id = #{purchaseApplyId}  and is_deleted = 0")
    BigDecimal getSumTaxTotalPriceByPurchaseApplyId(String purchaseApplyId);
    @Select("select sum(excluding_tax_unit_price*order_count) from bamu_purchase_apply_material where "
            + "purchase_apply_id = #{purchaseApplyId}  and is_deleted = 0")
    BigDecimal getSumNoTaxTotalPriceByPurchaseApplyId(String purchaseApplyId);
}
